My training of AB emus isn't working... going to explore
In [24]:
import matplotlib
#matplotlib.use('Agg')
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
In [25]:
import numpy as np
from pearce.mocks.kittens import TrainingBox, MDHR
In [26]:
cat = TrainingBox(boxno=0, system = 'sherlock')
In [27]:
cat.load(1.0, HOD = 'corrZheng07', hod_kwargs={'sec_haloprop_key': 'halo_local_density_10'})
In [28]:
cat.halocat.halo_table.colnames
Out[28]:
In [29]:
cat.model.param_dict
Out[29]:
In [30]:
print cat.model.param_dict.keys()
In [31]:
default_params = cat.model.param_dict
default_params['mean_occupation_centrals_assembias_corr1'] = 0.0
default_params['mean_occupation_satellites_assembias_corr1'] = 0.0
#default_params['mean_occupation_centrals_assembias_split1'] = 0.5
#default_params['mean_occupation_satellites_assembias_split1'] = 0.5
In [32]:
default_params['sigma_logM'] = 0.5
default_params['logMmin'] = 13.5
In [33]:
cat.model.model_dictionary['centrals_occupation'].sec_haloprop_key
Out[33]:
In [34]:
r_bins = np.logspace(-1.1, 1.6, 19)
rbc = (r_bins[1:]+r_bins[:-1])/2.0
In [35]:
#default_y = np.zeros((18,))
#for i in xrange(N):
# print i,
cat.populate(default_params)
default_y= cat.calc_xi(r_bins)
#default_y/=N
In [36]:
N = 7
cmap = sns.color_palette("GnBu_d", N)
In [37]:
pname = 'mean_occupation_satellites_assembias_corr1'
l, h = -1.0, 1.0
#l, h = 0.0, 1.0
d = default_params.copy()
for v, c in zip(np.linspace(l,h,N), cmap):
d[pname] = v
#y = np.zeros((18,))
#for i in xrange(N):
# print i,
cat.populate(d)
y= cat.calc_xi(r_bins)
print v, (y/default_y)[14]
#y/=N
plt.plot(rbc, y/default_y, label = v, c = c)
plt.xscale('log')
#plt.loglog()
plt.legend(loc = 'best')
plt.show();
In [38]:
from halotools.empirical_models.abunmatch.noisy_percentile import noisy_percentile
from scipy.stats import rankdata
In [39]:
N =11
x=(rankdata(np.linspace(0,10,N), 'ordinal')*1.0)/N# - 0.5
In [40]:
print x
print noisy_percentile(x, -1)
In [41]:
x[::-1]
Out[41]:
In [42]:
plt.hist(np.log(cat.halocat.halo_table['halo_nfw_conc'][np.isfinite(cat.halocat.halo_table['halo_nfw_conc'])] ))
Out[42]:
In [ ]: